package hu.test.atacama;

import java.util.ArrayList;
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

public class DataFromCloud implements Parcelable {

	private String message;

	private boolean error;

	private String command;

	private String serialNumber;

	@SerializedName("mapData") public List<DeviceInfo> deviceInfo;

	private List<Coordinates> pathData;

	private List<Car> carList;
	
	private List<Sensor> sensorList;

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public boolean isError() {
		return error;
	}

	public void setError(boolean error) {
		this.error = error;
	}

	public String getCommand() {
		return command;
	}

	public void setCommand(String command) {
		this.command = command;
	}

	public String getSerialNumber() {
		return serialNumber;
	}

	public void setSerialNumber(String serialNumber) {
		this.serialNumber = serialNumber;
	}

//	public List<DeviceInfo> getDeviceInfo() {
//		return deviceInfo;
//	}

	public void setDeviceInfo(List<DeviceInfo> deviceInfo) {
		this.deviceInfo = deviceInfo;
	}

	public List<Coordinates> getPathData() {
		return pathData;
	}

	public void setPathData(List<Coordinates> pathData) {
		this.pathData = pathData;
	}

	public List<Car> getCarList() {
		return carList;
	}

	public void setCarList(List<Car> carList) {
		this.carList = carList;
	}
	
	public List<Sensor> getSensorList() {
		return sensorList;
	}

	public void setSensorList(List<Sensor> sensorList) {
		this.sensorList = sensorList;
	}

	protected DataFromCloud(Parcel in) {
		message = in.readString();
		error = in.readByte() != 0x00;
		command = in.readString();
		serialNumber = in.readString();
		deviceInfo = new ArrayList<DeviceInfo>();
		in.readList(deviceInfo, DeviceInfo.class.getClassLoader());
		pathData = new ArrayList<Coordinates>();
		in.readList(pathData, Coordinates.class.getClassLoader());
		carList = new ArrayList<Car>();
		in.readList(carList, Car.class.getClassLoader());		
		sensorList = new ArrayList<Sensor>();
		in.readList(sensorList, Sensor.class.getClassLoader());
	}

	public int describeContents() {
		return 0;
	}

	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(message);
		dest.writeByte((byte) (error ? 0x01 : 0x00));
		dest.writeString(command);
		dest.writeString(serialNumber);
		dest.writeList(deviceInfo);
		dest.writeList(pathData);
		dest.writeList(carList);
		dest.writeList(sensorList);
	}

	public static final Parcelable.Creator<DataFromCloud> CREATOR = new Parcelable.Creator<DataFromCloud>() {
		public DataFromCloud createFromParcel(Parcel in) {
			return new DataFromCloud(in);
		}

		public DataFromCloud[] newArray(int size) {
			return new DataFromCloud[size];
		}
	};
}